package cn.yd.rb.service.serviceimpl;


import cn.yd.rb.mapper.AdminMapper;
import cn.yd.rb.po.Admin;
import cn.yd.rb.po.AdminExample;
import cn.yd.rb.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class AdminServiceImpl implements AdminService {

    @Autowired
    private AdminMapper adminMapper;

    @Override
    public Admin findAdminByLogin(Admin admin) throws Exception {
        AdminExample adminExample = new AdminExample();
        AdminExample.Criteria criteria = adminExample.createCriteria();
        criteria.andAdminnameEqualTo(admin.getAdminname());
        criteria.andPasswordEqualTo(admin.getPassword());
        List<Admin> list = adminMapper.selectByExample(adminExample);
        return list.get(0);
    }
}
